<?php
class Devfly Implements ArrayAccess
{
	
	private $vars = array();
	
	# Set a global var
	function set ( $key, $var )
	{
	
		if ( isset ( $this->vars[$key] ) == TRUE )
		{

			throw new Exception ( 'Unable to set var `' . $key . '`. Already set.' );

		}
		
		$this->vars[$key] = $var;
		
		return TRUE;

	}
	
	# Get a previously set global var
	function get ( $key )
	{

		if ( isset ( $this->vars[$key] ) == FALSE )
		{

			return null;

		}
		
		return $this->vars[$key];

	}
	
	# Remove a global var
	function remove ( $var )
	{
	
		unset ( $this->vars[$key] );
	
	}
	
	# --
	function offsetExists ( $offset )
	{
		return isset ( $this->vars[$offset] );
	}
	
	# --
	function offsetGet ( $offset )
	{
		return $this->get ( $offset );
	}
	
	# --
	function offsetSet ( $offset, $value )
	{
		$this->set ( $offset, $value );
	}
	
	# --
	function offsetUnset ( $offset )
	{
		unset( $this->vars[$offset] );
	}

}

?>